package cn.doitedu.producer.high;

import cn.doitedu.producer.high.tasks.DataFetcher;
import cn.doitedu.producer.high.tasks.DataSender;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Properties;
import java.util.concurrent.ArrayBlockingQueue;

public class ProducerEntrypoint {

    public static void main(String[] args) throws Exception {

        Properties properties = new Properties();
        properties.load(new FileReader("./conf/producer.properties"));


        // 构造一个阻塞队列
        ArrayBlockingQueue<String> queue = new ArrayBlockingQueue<>(100);

        // 构造数据读取任务线程，并启动
        new Thread(new DataFetcher(properties,queue)).start();

        // 构造数据发送任务线程，并启动
        new Thread(new DataSender(queue)).start();


        ArrayList<String> list = new ArrayList<>();

        Iterator<String> iterator = list.iterator();
        while(iterator.hasNext()){
            String element = iterator.next();
        }





    }


}
